
package com.chuhay.elemwar;

public class ElemWarConstants {
   /** The dimensions of our sprite in pixels. */
   public static final int SIZE = 36;

   /** The distance from the center to the corner of a hex */
   public static final int CORNERDIST = SIZE / 2;

   /** Board region constants */
   public static final int AREA_BOARD = 0;
   public static final int AREA_FIRE_HOME = 1;
   public static final int AREA_FIRE_GOAL = 2;
   public static final int AREA_ICE_HOME = 3;
   public static final int AREA_ICE_GOAL = 4;

   /** Piece type constants */
   public static final int PIECE_FIRE = 0;
   public static final int PIECE_ICE = 1;
   public static final int PIECE_EARTH = 2;
   public static final int PIECE_EMPTY = 3;

   /** Hex type constants */
   public static final int HEX_FIRE = 0;
   public static final int HEX_ICE = 1;
   public static final int HEX_FILLED = 2;
   public static final int HEX_EMPTY = 3;

   /** Selection state constants */
   public static final int SELECT_SELECTED = 0;
   public static final int SELECT_UNSELECTED = 1;
   public static final int SELECT_VALID = 2;
   
   /** Move validation constants */
   public static final int VALID_VALID_MOVE = 0;
   public static final int VALID_VALID_SELECT = 1;
   public static final int VALID_VALID_DESELECT = 2;
   public static final int VALID_INVALID = 3;

   // Arrays of row delimiters for drawing the board pieces
   protected static final int [][] boardRowEnds = { {4, 10}, {3, 10}, {3, 11}, {2, 11}, {2, 12},
         {1, 12}, {2, 12}, {2, 11}, {3, 11}, {3, 10}, {4, 10}};

   protected static final int [][][] goalRowEnds = { { {1, 4}, {0, 3}, {0, 3}, {0, 2}, {1, 2}},
         { {10, 13}, {10, 13}, {11, 14}, {11, 13}, {12, 13}}};

   protected static final int [][][] homeRowEnds = { { {1, 2}, {0, 2}, {0, 3}, {0, 3}, {1, 4}},
         { {12, 13}, {11, 13}, {11, 14}, {10, 13}, {10, 13}}};

   // Returns the string for a given hex constant
   public static String intToHex (int hexType) {
      switch (hexType) {
      case HEX_EMPTY:
         return "HEX_EMPTY";
      case HEX_FIRE:
         return "HEX_FIRE";
      case HEX_ICE:
         return "HEX_ICE";
      default:
         return "Invalid hex type";
      }
   }

   // Returns the string for a given piece constant
   public static String intToPiece (int pieceType) {
      switch (pieceType) {
      case PIECE_FIRE:
         return "PIECE_FIRE";
      case PIECE_ICE:
         return "PIECE_ICE";
      case PIECE_EARTH:
         return "PIECE_EARTH";
      case PIECE_EMPTY:
         return "PIECE_EMPTY";
      default:
         return "Invalid hex type";
      }
   }

   /* enums that can't be streamed :(
    * 
    * protected enum Area implements Streamable{ BOARD, FIRE_HOME, FIRE_GOAL,
    * ICE_HOME, ICE_GOAL }
    * 
    * protected enum PieceType implements Streamable{ FIRE, ICE, EARTH, EMPTY; }
    * 
    * protected enum HexType implements Streamable{ EMPTY, FIRE, ICE, STEAM, }
    * 
    * protected enum SelectState implements Streamable{ SELECTED, UNSELECTED,
    * VALID }
    */
}
